package bocchi.action;

import bocchi.base.BaseCustomPower;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.powers.AbstractPower;

public class FinaleAction extends AbstractGameAction {
    private final AbstractGameAction action;

    public FinaleAction(AbstractGameAction action) {
        actionType = ActionType.SPECIAL;
        duration = Settings.ACTION_DUR_FAST;
        this.action = action;
    }

    @Override
    public void update() {
        if (action == null) {
            isDone = true;
            return;
        }

        addToTop(action);
        for (AbstractPower power : source.powers) {
            if (power instanceof BaseCustomPower) {
                ((BaseCustomPower) power).onFinale();
            }
        }
        isDone = true;
    }
}
